function RemoteData(){
  var instance = (function() {
    var privateVar;
    var storage={};
    function test_request (options) {
/*      if( typeof(options.fail)!='undefined' ){
        options.url=options.url.replace('success',options.fail);
				$.ajax({
				  url: options.url,
				  dataType: "json",
	      	async: true,
					success: function(dt){
					  options.onFailure(dt);
					}
				});
			}else{
*/
				$.ajax({
				  url: options.url,
				  dataType: "json",
	      	async: true,
					success: function(dt){
					  options.onSuccess(dt);
					},
					error: function(err_resp){
					  options.onFailure(err_resp);
					}
				});
/*			}
*/
    }

    return { // public interface
      //Cache inside DOM model methods begin
      get:function(nm) {
        if( typeof(storage[nm])=='undefined' ) return false;
        return storage[nm];
			},
			set:function(nm,val){
			  storage[nm]=val;
			  return true;
			},
			//Cache inside DOM model methods end
			
			//методы реализуют загрузку/выгрузку данных - должны конкретизимроваться
			//авторизация
      login:function (options){
        options.url='json/login_success.json';
        test_request( options );
			},
			loadKPISources:function(options){
			  //setTimeout(function(){
					options.url='json/loadKPISources_success.json';
	        test_request( options );
				//},2000);
			},
			loadKPIs:function(options){
			  //setTimeout(function(){
	        options.url='json/loadKPIs.json';
	        test_request( options );
        //},2000);
			},
			sendLog:function(options){
        options.url='json/send_log.json';
        test_request( options );
        return true;
			},
			change_password:function (options){
        options.url='json/chpass_success.json';
        test_request( options );
			},
    };
  })();

  RemoteData = function () { // re-define the function for subsequent calls
    return instance;
  };

  return RemoteData(); // call the new function
}
RemoteData=new RemoteData();